/**
 * Created by 小敏哥on 2017/3/6.
 */
import {
    USE_COUPON,
    ORDER_INFO,
    PAY_SCRIPT
} from "../actions/actionsTypes"
//couponId默认值传default表示默认状态，服务器会返回默认的优惠券Id，之后会根据实际id对couponId进行设置
export default function commfirmOrderReducer(state = {payScript:'',useCoupon:{couponId:'default'}}, action) {
    switch (action.type) {
        case USE_COUPON:
            return Object.assign({}, state, {useCoupon: action.data});
        case ORDER_INFO:
            return Object.assign({}, state, {orderInfo: action.data});
        case PAY_SCRIPT:
            return Object.assign({}, state, {payScript: action.data});
        default:
            return state;
    }
}